package beans;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

@Entity
@Inheritance(strategy=InheritanceType.JOINED)
@Table(name="Depositos")
public class DepositoBean implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="idDeposito",nullable=false)
	private int idDeposito;
	
	@OneToMany(fetch=FetchType.EAGER,cascade=CascadeType.ALL)
	@Fetch(FetchMode.SUBSELECT)
	@JoinColumn(name="idDeposito")
	private List<ItemStockBean> stock;
	
	@Column(name="descripcion")
	private String descripcion;
	
	public List<ItemStockBean> getStock() {
		return stock;
	}

	public void setStock(List<ItemStockBean> stock) {
		this.stock = stock;
	}
	
	public DepositoBean(){
		this.stock=new ArrayList<ItemStockBean>();
	}

	public int getIdDeposito() {
		return idDeposito;
	}

	public void setIdDeposito(int idDeposito) {
		this.idDeposito = idDeposito;
	}

	public String getDescripcion() {
		return descripcion;
	}

	public void setDescripcion(String descripcion) {
		this.descripcion = descripcion;
	}

	
}
